/* $Id:category.h $ */
/*
   Copyright (C) 2007 by Jurjen Stellingwerff <jurjen@stwerff.xs4all.nl>
   Part of the Moros Project http://moros.sourceforge.net/

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 3.
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY.

   See the COPYING file for more details.
*/

#ifndef __CATEGORY_H
#define __CATEGORY_H

#include <string>
#include <map>
#include <list>
using namespace std;

#include "background_level.h"

#define loopCategoryLevel(r,v) loopSingle((r)->listLevel(),v,class background_level,list)

class category {
    int nr;
    string name;
    int age;
    map<string,class background_level> level;
    int experience;
    int armor;
public:
    category();

    // Field : nr
    const int getNr() const;
    void setNr(const int v);
    int operator<(const class category &ck) const;

    // Field : name
    const string getName() const;
    void setName(const string v);

    // Field : age
    const int getAge() const;
    void setAge(const int v);

    // Field : level
    class background_level& getLevel(const string v);
    list<class background_level>& listLevel();
    void setLevel(class background_level &v);
    void delLevel(const string v);
    const bool isLevel(const string v) const;

    // Field : experience
    const int getExperience() const;
    void setExperience(const int v);

    // Field : armor
    const int getArmor() const;
    void setArmor(const int v);

    void save(class channel &ch);
    void load(class channel &ch);
    void xml(ofstream &f, int l=0, int r=0);
};

#endif // __CATEGORY_H
